<template>
  <div>
    <h1>这是child的组件</h1>
    父组件传递过来的数据：{{msg}}
    <button @click="send">传值给父组件</button>
  </div>
</template>


<script>
import { defineComponent, ref } from "vue";
export default defineComponent({
  name: "Child",
  props: {
    msg: {
      type: String
    }
  },
  setup(props,ctx) {
    let childMsg = ref('我是子组件的数据')
    console.log(props.msg)
    let send = ()=>{
       ctx.emit('send',childMsg.value)
    }
    return {
      childMsg,
      send
    };
  },
});
</script>

<style lang="scss" scoped>

</style>